package com.szh.mysobproject.util

import android.app.Activity
import android.content.Context
import android.content.Intent
import com.dylanc.longan.startActivity

inline fun <reified T> Context.startActivity(block: Intent.() -> Unit = {}) {
    val context = this
    Intent(this, T::class.java).apply(block).run {
        if (context !is Activity) {
            addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        }
        startActivity(this)
    }
}